package com.hex.ds.hdtp.core.web.dqc.controller;

import com.hex.bigdata.hbda.annotation.Log;
import com.hex.ds.hdtp.core.app.common.page.dto.PageDto;
import com.hex.ds.hdtp.core.app.dqc.dto.request.DqcTaskLogRequestDto;
import com.hex.ds.hdtp.core.app.dqc.service.IDqcTaskLogService;
import com.hex.ds.hdtp.core.web.common.page.PageVo;
import com.hex.ds.hdtp.core.web.common.page.converter.IPageVoAndPageDtoConverter;
import com.hex.ds.hdtp.core.web.dqc.converter.IDqcTaskLogVoConverter;
import com.hex.ds.hdtp.core.web.dqc.vo.DqcTaskLogVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(tags = "定制化-DQC校验：日志审计")
@RequestMapping("/api/dqc/task/log")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class DqcTaskLogController {
    private final IDqcTaskLogVoConverter dqcTaskLogVoConverter;

    private final IPageVoAndPageDtoConverter pageVoAndPageDtoConverter;

    private final IDqcTaskLogService iDqcTaskLogService;

    @Log("Dqc日志查询")
    @GetMapping
    @ApiOperation("Dqc日志查询")
    public ResponseEntity queryListByPage(DqcTaskLogVo dqcTaskLogVo, PageVo pageVo) {
        log.info("进入【DqcTaskLogController.queryListByPage】方法，参数为" + dqcTaskLogVo.toString());
        DqcTaskLogRequestDto dqcTaskLogRequestDto = dqcTaskLogVoConverter.toDqcTaskLog(dqcTaskLogVo);
        final PageDto pageDto = pageVoAndPageDtoConverter.toPageDto(pageVo);
        return ResponseEntity.ok(iDqcTaskLogService.queryListByPage(dqcTaskLogRequestDto, pageDto));
    }
}
